/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* 霓虹灯主题基础设置 */
body {
    background-color: #0f0b21;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(120, 40, 200, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 60, 120, 0.1) 0%, transparent 40%);
    color: #fff;
    min-height: 100vh;
}

/* 应用容器 */
.app-container {
    display: flex;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

/* 好友列表侧边栏 */
.friends-sidebar {
    width: 300px;
    background-color: rgba(15, 11, 33, 0.9);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    box-shadow: 5px 0 15px rgba(120, 40, 200, 0.1);
    z-index: 10;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 退出登录按钮 */
.logout-btn {
    padding: 8px 15px;
    background-color: rgba(255, 60, 120, 0.1);
    border: 1px solid #ff3c78;
    color: #fff;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

/* 搜索框 */
.search-box {
    position: relative;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 35px;
    border-radius: 20px;
    border: 1px solid rgba(120, 40, 200, 0.5);
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    outline: none;
}

.search-box i {
    position: absolute;
    left: 25px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
}

/* 好友列表 */
.friends-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.friends-list h3 {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    text-transform: uppercase;
    padding: 10px 15px;
    letter-spacing: 1px;
}

.friends-list ul {
    list-style: none;
}

.friends-list li {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 5px;
}

.friends-list li:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.friends-list li.active {
    background-color: rgba(120, 40, 200, 0.1);
    border-left: 3px solid #7828c8;
}

.friends-list li img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
}

.friend-info {
    flex: 1;
    overflow: hidden;
}

.friend-info .name {
    display: block;
    font-weight: 500;
    margin-bottom: 3px;
}

.friend-info .last-msg {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.online-dot {
    width: 10px;
    height: 10px;
    background-color: #00ffcc;
    border-radius: 50%;
    box-shadow: 0 0 5px #00ffcc, 0 0 10px #00ffcc;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(120, 40, 200, 0.2);
    border: 1px solid #7828c8;
    color: #fff;
    cursor: pointer;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

/* 聊天室容器 */
.chat-container {
    width: 100%;
    height: 100%;
    background-color: rgba(15, 11, 33, 0.8);
    display: flex;
    flex-direction: column;
}

/* 聊天室头部 */
.chat-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(90deg, rgba(120, 40, 200, 0.1), rgba(255, 60, 120, 0.1));
}

.current-chat-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.small-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 5px #00ffcc, 0 0 10px #00ffcc;
}

/* 霓虹灯标题效果 */
.neon-title {
    color: #fff;
    text-shadow:
        0 0 5px #fff,
        0 0 10px #fff,
        0 0 15px #7828c8,
        0 0 20px #7828c8,
        0 0 25px #7828c8;
}

/* 在线指示器 */
.online-indicator {
    display: flex;
    align-items: center;
    color: #00ffcc;
    font-size: 14px;
}

.dot {
    width: 10px;
    height: 10px;
    background-color: #00ffcc;
    border-radius: 50%;
    margin-right: 5px;
    box-shadow: 0 0 5px #00ffcc, 0 0 10px #00ffcc;
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 滚动条美化 */
.chat-messages::-webkit-scrollbar,
.friends-list::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.friends-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb,
.friends-list::-webkit-scrollbar-thumb {
    background: rgba(120, 40, 200, 0.5);
    border-radius: 10px;
}

/* 消息样式 */
.message {
    display: flex;
    max-width: 80%;
    animation: fadeIn 0.3s ease-in-out;
    align-items: flex-end; /* 确保头像与消息底部对齐 */
}

.received {
    align-self: flex-start;
}

.sent {
    align-self: flex-end;
    flex-direction: row; /* 发送者消息采用正常方向排列 */
}

/* 头像样式 */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
}

.received .avatar {
    margin-right: 10px; /* 接收者头像右侧有间距 */
    box-shadow: 0 0 5px #00ffcc, 0 0 10px #00ffcc;
}

.sent .avatar {
    margin-left: 10px; /* 发送者头像左侧有间距 */
    box-shadow: 0 0 5px #ff3c78, 0 0 10px #ff3c78;
}

/* 消息气泡 */
.message-bubble {
    padding: 12px 15px;
    border-radius: 18px;
    position: relative;
    line-height: 1.4;
    max-width: calc(100% - 50px); /* 为头像留出空间 */
}

.received .message-bubble {
    background-color: rgba(0, 255, 204, 0.15);
    border: 1px solid rgba(0, 255, 204, 0.3);
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.2);
    color: #e0f7fa;
    border-top-left-radius: 5px;
}

.sent .message-bubble {
    background-color: rgba(255, 60, 120, 0.15);
    border: 1px solid rgba(255, 60, 120, 0.3);
    box-shadow: 0 0 10px rgba(255, 60, 120, 0.2);
    color: #ffebee;
    border-top-right-radius: 5px;
}

/* 时间戳 */
.time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 5px;
    display: block;
    text-align: right;
}

/* 输入区域 */
.chat-input {
    padding: 15px;
    display: flex;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(90deg, rgba(120, 40, 200, 0.1), rgba(255, 60, 120, 0.1));
}

.chat-input input {
    flex: 1;
    padding: 12px 15px;
    border-radius: 20px;
    border: 1px solid rgba(120, 40, 200, 0.5);
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
}

.chat-input input:focus {
    border-color: #7828c8;
    box-shadow: 0 0 10px rgba(120, 40, 200, 0.5);
}

.chat-input input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* 发送按钮和霓虹灯按钮效果 */
.send-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: rgba(120, 40, 200, 0.2);
    border: 1px solid #7828c8;
    color: #fff;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.neon-btn {
    box-shadow: 0 0 5px #7828c8, 0 0 10px #7828c8;
}

.neon-btn:hover {
    box-shadow: 0 0 10px #7828c8, 0 0 20px #7828c8;
    background-color: rgba(120, 40, 200, 0.3);
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .friends-sidebar {
        position: absolute;
        left: -300px;
        height: 100%;
        transition: left 0.3s ease;
    }

    .friends-sidebar.active {
        left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .message {
        max-width: 90%;
    }
}
/* 消息气泡 - 新增自动换行处理 */
.message-bubble {
    padding: 12px 15px;
    border-radius: 18px;
    position: relative;
    line-height: 1.4;
    max-width: calc(100% - 50px); /* 为头像留出空间 */
    word-wrap: break-word; /* 强制长单词或URL换行 */
    white-space: normal; /* 允许文本正常换行 */
    overflow-wrap: break-word; /* 当内容超过容器宽度时，在单词内换行 */
    hyphens: auto; /* 自动连字符（增强长单词换行效果） */
}